#include "FramedSource.hh"
#include "UsageEnvironment.hh"

#define JPEG_HEADER_MAX_SIZE 623

class IPCameraMPEG4ESVideoSource :
	public FramedSource
{
public:
	static IPCameraMPEG4ESVideoSource* createNew(UsageEnvironment& env, char* url);
	Boolean isMPEG4VideoStreamFramer();

public:
	virtual u_int8_t type();
	virtual u_int8_t width(); // # pixels/8 (or 0 for 2048 pixels)
	virtual u_int8_t height(); // # pixels/8 (or 0 for 2048 pixels)

protected:
	IPCameraMPEG4ESVideoSource(UsageEnvironment& env, char* url);
	~IPCameraMPEG4ESVideoSource(void);

	char* rtspURL;

private:
	// redefined virtual functions:
	virtual void doGetNextFrame();
	virtual void doStopGettingFrames();

private:
	u_int8_t fLastWidth;
	u_int8_t fLastHeight;

public:
	int		prevImageLength;
	int		int_stream_id;
	void*	ptr_frame_buffer;
};
